package org.anti996.bankms.view;

import org.anti996.bankms.dao.UserDao;
import org.anti996.bankms.model.Card;
import org.anti996.bankms.util.MessageUtil;

import java.util.List;

public class UserCardChooseView implements ViewBase {
    private final List<Card> cards_;

    public UserCardChooseView(List<Card> cards) {
        cards_ = cards;
    }

    @Override
    public void show() {
        MessageUtil.infoln("请选择您的银行卡：");
        String[] cardList = new String[cards_.size()];
        for (int i = 0; i < cards_.size(); i++) {
            Card c = cards_.get(i);
            cardList[i] = String.format("卡号：%s，币种：%s，余额：%.2f", c.getId(), UserDao.CURRENCY_NAMES.get(c.getCurrency()), c.getBalance());
        }
        MessageUtil.itemList(cardList);
    }
}
